package com.bj58.mis.apm.server.kylin.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class SelectRule {
    public String[][] hierarchyDims;
    public String[] mandatoryDims;
    public String[][] jointDims;
    public Integer dimCap;
    public SelectRule() {
    }
    public SelectRule(Map<String, Object> ruleMap){
        Object obj = ruleMap.get("hierarchy_dims");
        if(obj != null){
            List<List<String>> list = (List<List<String>>)obj;
            this.hierarchyDims = new String[list.size()][];
            for(int i = 0; i < list.size(); i++){
                this.hierarchyDims[i] = list.get(i).toArray(new String[list.get(i).size()]);
            }
        }
        obj = ruleMap.get("mandatory_dims");
        if(obj != null){
            List<String> list = (List<String>)obj;
            this.mandatoryDims = list.toArray(new String[list.size()]);
        }
        obj = ruleMap.get("joint_dims");
        if(obj != null){
            List<List<String>> list = (List<List<String>>)obj;
            this.jointDims = new String[list.size()][];
            for(int i = 0; i < list.size(); i++){
                this.jointDims[i] = list.get(i).toArray(new String[list.get(i).size()]);
            }
        }
        obj = ruleMap.get("dim_cap");
        if(obj != null) {
            this.dimCap = (Integer) obj;
        }
    }

    public String[][] getHierarchyDims() {
        return hierarchyDims;
    }

    public void setHierarchyDims(String[][] hierarchyDims) {
        this.hierarchyDims = hierarchyDims;
    }

    public String[] getMandatoryDims() {
        return mandatoryDims;
    }

    public void setMandatoryDims(String[] mandatoryDims) {
        this.mandatoryDims = mandatoryDims;
    }

    public String[][] getJointDims() {
        return jointDims;
    }

    public void setJointDims(String[][] jointDims) {
        this.jointDims = jointDims;
    }

    public Integer getDimCap() {
        return dimCap;
    }

    public void setDimCap(Integer dimCap) {
        this.dimCap = dimCap;
    }
}
